#include "MVDataMBCommon.h"

// 构造和析构函数
CMVDataMBCommon::CMVDataMBCommon()
{
	m_iMVx = 0;
	m_iMVy = 0;
	m_bMVSetted = false;

	m_iASAD = 0;
	m_bASADSetted = false;

	m_iSADBitCount = 0;
	m_bSADBitCountSetted = false;
}

CMVDataMBCommon::CMVDataMBCommon( const CMVDataMBCommon& mb_common )
{
	m_iMVx = mb_common.m_iMVx;
	m_iMVy = mb_common.m_iMVy;
	m_bMVSetted = mb_common.m_bMVSetted;

	m_iASAD = mb_common.m_iASAD;
	m_bASADSetted = mb_common.m_bASADSetted;

	m_iSADBitCount = mb_common.m_iSADBitCount;
	m_bSADBitCountSetted = mb_common.m_bSADBitCountSetted;

}
CMVDataMBCommon::~CMVDataMBCommon()
{
	return;
}

bool CMVDataMBCommon::HaveMVCoordinate() const
{
	return m_bMVSetted;
}

int CMVDataMBCommon::SetMVCoordinate( int x, int y )
{
	m_iMVx = x;
	m_iMVy = y;
	m_bMVSetted = true;

	return 0;
}

int CMVDataMBCommon::GetMVCoordinate( int& x, int& y ) const
{
	x = m_iMVx;
	y = m_iMVy;

	return 0;
}

int CMVDataMBCommon::GetMVCoordinateX() const
{
	return m_iMVx;
}

int CMVDataMBCommon::GetMVCoordinateY() const
{
	return m_iMVy;
}

// 当前是否包含SAD属性
bool CMVDataMBCommon::HaveASAD() const
{
	return m_bASADSetted;
}

// 设置Average SAD属性
int CMVDataMBCommon::SetASAD( int asad )
{
	m_iASAD = asad;
	m_bASADSetted = true;
	return 0;
}

// 取得Average SAD属性
int CMVDataMBCommon::GetASAD() const
{
	return m_iASAD;
}

bool CMVDataMBCommon::HaveSADBitCount() const
{
	return m_bSADBitCountSetted;
}

// 设置SAD BitCount 属性
int CMVDataMBCommon::SetSADBitCount( int bitcount )
{
	m_iSADBitCount = bitcount;
	m_bSADBitCountSetted = true;
	return 0;
}

// 取得SAD BitCount 属性
int CMVDataMBCommon::GetSADBitCount() const
{
	return m_iSADBitCount;
}

CMVDataMBCommon& CMVDataMBCommon::operator = ( const CMVDataMBCommon & mb_common )
{
	m_iMVx = mb_common.m_iMVx;
	m_iMVy = mb_common.m_iMVy;
	m_bMVSetted = mb_common.m_bMVSetted;
	m_iASAD = mb_common.m_iASAD;
	m_bASADSetted = mb_common.m_bASADSetted;
	m_iSADBitCount = mb_common.m_iSADBitCount;
	m_bSADBitCountSetted = mb_common.m_bSADBitCountSetted;

	return *this;
}
